home *** CD-ROM | disk | FTP | other *** search
- Path: uhura.phoenix.net!usenet
- From: brucew@phoenix.net (Bruce Wedding)
- Newsgroups: comp.lang.c
- Subject: Re: About union
- Date: Tue, 16 Apr 1996 23:03:45 GMT
- Organization: BranPaul Systems
- Message-ID: <4l19a7$3ok@uhura.phoenix.net>
- References: <4kfj5g$24n@dewey.csun.edu> <smryanDpqCB7.F0w@netcom.com>
- NNTP-Posting-Host: dial141.phoenix.net
- X-Newsreader: Moe's Newsreader
-
- In comp.lang.c
- smryan@netcom.com (@#$%!?!) wrote:
-
- I've often used, with no problems the following construct, or
- similar:
-
- typedef union {
- unsigned char byte;
- unsigned int bit_0 : 1;
- unsigned int bit_1 : 1;
- unsigned int bit_2 : 1;
- unsigned int bit_3 : 1;
- unsigned int bit_4 : 1;
- unsigned int bit_5 : 1;
- unsigned int bit_6 : 1;
- unsigned int bit_7 : 1;
- } BIT;
-
- It seems that, according to the standard, it is undefined
- behavior to access the individual bits, after assigning a
- character to byte. Anyone have any thoughts on this?
-
- Bruce
-
-
-